package cc.idoone.spring_boot_hello.schedule;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author hemj
 * @since 2017/10/21
 */
@Component
public class SchedulerCronTask {

	private int count = 0;
	private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	@Scheduled(cron="1 * * * * ?")
	private void process() {
		System.out.println("SchedulerCronTask " + sdf.format(new Date()) + ":" + (count++));
	}
}
